function $id(id){
    return document.getElementById(id);
}
function byClass(name, elem){
    return (elem || document).getElementsByClassName(name);
}

function playMovie(){
    var obj = $id('splayer');
    if (obj) {
        if (obj.paused) {
            obj.play();
        } else {
            obj.pause();
        }
    }
};
function loadMovie(source){
    var obj = $id('splayer');
    if (obj && obj.src.indexOf(source) == -1) {
        obj.src = source;
        obj.load();
    }
    playMovie(obj);
};
function toggleShow(objId, target){
    var obj = $id(objId);
    if (obj) {
        if (obj.style.display == 'none') {
            obj.style.display = '';
            target.className = 'hide';
            byClass('playBox')[0].style.width = '644px';
            byClass('primary', $id('body'))[0].style.width = '888px';
            byClass('primary', $id('body'))[0].style.borderRight = '1px solid #ccc';
            if (byClass('secondary', $id('body'))[0]) {
                byClass('secondary', $id('body'))[0].style.display = '';
            }
            if (byClass('primary', $id('footer'))[0]) {
                byClass('primary', $id('footer'))[0].style.width = '';
            }
        } else {
            obj.style.display = 'none';
            target.className = 'show';
            byClass('playBox')[0].style.width = 'auto';
            byClass('primary', $id('body'))[0].style.width = '980px';
            byClass('primary', $id('body'))[0].style.border = '0';
            if (byClass('secondary', $id('body'))[0]) {
                byClass('secondary', $id('body'))[0].style.display = 'none';
            }
            if (byClass('primary', $id('footer'))[0]) {
                byClass('primary', $id('footer'))[0].style.width = '980px';
            }
        }
    }
}
function highLight(obj) {
	$(obj).parent().parent().find('li').removeClass('active');
	$(obj).parent().addClass('active');
	var player = $id('splayer');
	if (player) {
		player.addEventListener('ended', function(){
			$(obj).parent().next().find('a').click();
		}, false);
	}
}

function loadXML(xmlUrl, callback, current, add, add2){
    var cur = current || 1;
    $.ajax({
        url: xmlUrl,
        type: 'GET',
        dataType: 'xml',
        timeout: 1000,
        cache: false,
        error: function(xhr, textStatus, errorThrown){
            //alert(xhr.status+'，'+textStatus+'，'+errorThrown);
            //alert('加载文件出错，请稍候重试');
        },
        success: function(xml){
            callback(xml, cur, add, add2);
        }
    });
}

function toLink(mId, subId){
	$('#Detail').hide();
	window.first = false;
    var number = subId || 1;
    loadXML('/iface/ipadlist/' + mId + '/%E5%85%A8%E9%83%A8/%E5%85%A8%E9%83%A8/%E5%85%A8%E9%83%A8/' + number + '.xml', initChannel, mId);
}
function toPlay(mId,p){
	if(typeof p == "undefined")
	{
		p = 1;
	}
    loadXML('/iface/vod/' + mId + '/'+ p +'.xml', initPlayer, mId);
}
function toTv(mId, p){
	if(typeof p == "undefined")
	{
		p = 1;
	}
    loadXML('/iface/vod/' + mId + '/'+ p +'.xml', initTvPlayer, mId);
}
function toLive(mId, day, fresh){
    var day = day || 1;
    var now =new Date();
    var tmp = new Date(now - (day-1) * 24 * 60 * 60 * 1000);
    var y = tmp.getFullYear();
    var m = tmp.getMonth()+1;
    var d = tmp.getDate();
    if(m<10)m="0"+m;
    if(d<10)d="0"+d;
    var strdat = y+"-"+m+"-"+d;
    loadXML('/iface/live/' + mId + '/' + strdat + '.xml', initLivePlayer, mId, day, fresh);
}
function initMainNavOnly(obj){
    var htmlStr = '';
    $(obj).find('navigation').each(function(i){
        var name = $(this).attr('text');
        var id = $(this).attr('id');
        var type = $(this).attr('type');
		htmlStr += '<a href="javascript:;" onclick="toLink(' + id + ');highLight(this);" id="ch' + id + '" type="' + type + '">' + name + '</a><span><img src="/images/iphone/nav_split.png" /></span>';
        //htmlStr += '<li><a href="javascript:;" onclick="toLink(' + id + ');highLight(this);" class="nav" id="ch' + id + '" type="' + type + '">' + name + '</a></li>';
    });
    //htmlStr = '<ul>' + htmlStr + '</ul>';
    $('#mainNav').append(htmlStr);
}
function initMainNav(obj){
    var htmlStr = '';
    $(obj).find('navigation').each(function(i){
        var name = $(this).attr('text');
        var id = $(this).attr('id');
        var type = $(this).attr('type');
		htmlStr += '<a href="javascript:;" onclick="toLink(' + id + ');highLight(this);" id="ch' + id + '" type="' + type + '">' + name + '</a><span><img src="/images/iphone/nav_split.png" /></span>';
        //htmlStr += '<li><a href="javascript:;" onclick="toLink(' + id + ');highLight(this);" class="nav" id="ch' + id + '" type="' + type + '">' + name + '</a></li>';
    });
    //htmlStr = '<ul>' + htmlStr + '</ul>';
    $('#mainNav').append(htmlStr);
    $('#ch1').click();
    $(".nav:first").trigger('click');
}
function initChannel(obj, id){
	$('#duzi').show();
    var pageCount = $(obj).find('page_count').text() - 0;
    var pageNow = $(obj).find('page').text() - 0;
    $('#fenye').empty();
    if (pageCount > pageNow) {
        var nextStr = '<a href="javascript:;" onclick="toLink(' + id + ',' + (pageNow + 1) + ')" class="nextChannel">下一页</a>'
        $('#fenye').append(nextStr);
    }
    if (pageNow != 1) {
        var prevStr = '<a href="javascript:;" onclick="toLink(' + id + ',' + (pageNow - 1) + ')" class="prevChannel">上一页</a>'
        $('#fenye').append(prevStr);
    }
    var htmlStr = '';
	$('#mov_list').empty();
    $(obj).find('main item').each(function(i){
        var imgurl = $.trim($(this).find('imgurl').text());
        var type = $(this).attr('type');
        var vid = $(this).attr('vid');
        var title = $.trim($(this).find('title').text());
		if (type == 'vod') {
			htmlStr += '<li><a href="mov.html?id=' + vid + '" title="' + title + '"><img src="' + imgurl + '" /><span class="UIRoundedImage_Corners"><img src="/images/iphone/UIRoundedImage.png"/></span><span class="tit">' + title + '</span></a></li>';
            //htmlStr += '<li onclick="toPlay(' + vid + ')" style="background:url(' + imgurl + ');background-size:cover;" title="' + title + '" /></li>';
        }
		else {//live
			htmlStr += '<li><a href="zb.html?id=' + vid + '" title="' + title + '"><img src="' + imgurl + '" /><span class="UIRoundedImage_Corners"><img src="/images/iphone/UIRoundedImage.png"/></span><span class="tit">' + title + '</span></a></li>';
			//htmlStr += '<li><a onclick="toLive(' + vid + ')" href="javascript:;" title="' + title + '" target="_blank"><img src="' + imgurl + '" /><span class="UIRoundedImage_Corners"><img src="/images/iphone/UIRoundedImage.png"/></span><span class="tit">' + title + '</span></a></li>';
            //htmlStr += '<li onclick="toLive(' + vid + ')" style="background:url(' + imgurl + ');background-size:cover;" title="' + title + '" /></li>';
        }
    });
    htmlStr = '<ul class="channel">' + htmlStr + '</ul>';
	$('#mov_list').append(htmlStr);
    //$('#body').empty();
    //$('#body').append(htmlStr);
}
function initBest(obj, mId){
    var htmlStr = '';
    $(obj).find('main item').each(function(i){
        var imgurl = $.trim($(this).find('imgurl').text());
        var type = $(this).attr('type');
        var vid = $(this).attr('vid');
        var title = $.trim($(this).find('title').text());
        if (type == 'vod') {
            htmlStr += '<li onclick="toPlay(' + vid + ')" style="background:url(' + imgurl + ');background-size:cover;" title="' + title + '" /></li>';
        } else {
            htmlStr += '<li onclick="toLive(' + vid + ')" style="background:url(' + imgurl + ');background-size:cover;" title="' + title + '" /></li>';
        }
    });
    if (mId != '0') {
        var extra = '<li class="back" /></li>';
        htmlStr = '<div class="secondary"><ul class="channel cLive">' + extra + htmlStr + '</ul></div>';
        $('#body').append(htmlStr);
        $('.secondary .cLive .back').bind('click', function() {
            toLive(mId);
        });
    } else {
        htmlStr = '<div class="secondary"><ul class="channel cLite">' + htmlStr + '</ul></div>';
        $('#body').append(htmlStr);
    }
}
function initPlayer(obj, mId){
	var linenum = $(obj).find('video_list').attr('linenum');
	$('#Detail').show();
	var tv=0;
	$(obj).find('title').each(function(){
		tv++;
	})
if (tv>1)
{
	//电视剧
	var i=0;
	var sub_title = new Array();
	var sub_url = new Array();
	var title;
	$(obj).find('title').each(function(){
		if (i===0)
		{
			title = $.trim($(this).text());
		}
		else
		{
			sub_title[i-1] = $.trim($(this).text());
		}
		i++;
	})
	i=0;
	$(obj).find('url').each(function(){
		sub_url[i] = $.trim($(this).text());
		i++;
	})
	var sub_jiStr = '';
	for(i=0;i<sub_title.length;i++)
	{
		sub_jiStr += '<li><a href="'+sub_url[i]+'" target="_self">'+sub_title[i]+'</a></li>';
		//sub_jiStr += '<li><a href="'+sub_url[i]+'" target="_self"><span style=" color:#FFF;">'+sub_title[i]+'</span></a></li>';
	}
}
	$('#duzi').show();
    //var title = $.trim($(obj).find('title').text());
    var score = $(obj).find('item').attr('mark');
    var director = $.trim($(obj).find('director').text());
    var actor = $.trim($(obj).find('act').text());
    var imgurl = $.trim($(obj).find('imgurl').text());
    var content = $.trim($(obj).find('content').text());
if (tv>1)
{
    var file = sub_url[0];
}
else
{
	var title = $.trim($(obj).find('title').text());
    var file = $.trim($(obj).find('file').text());
}
    /*var htmlStr = '';
    var picStr = '<div class="pic"><img src="' + imgurl + '" width="120" height="158" title="' + title + '" /></div>';
    var scoreStr = '<div class="score">评分：<br /><span class="num">' + score + '</span></div>';
    var castStr = '<div class="cast">导演：' + director + '<br />主演：' + actor + '</div>';
    var textStr = '<div class="text">剧情: <br />' + content + '</div>';
    var playBoxStr = '<div class="playBox"><h1>' + title + '</h1><video id="splayer" width="100%" height="520" controls="controls" autoplay="autoplay"><source src="' + file + '" type="video/mp4" /></video></div>';
    htmlStr = '<div class="primary"><div id="infoBox"><div class="infoBox">' + picStr + scoreStr + castStr + textStr + '</div></div>' + playBoxStr + '</div>';
    $('#body').empty();
    $('#body').append(htmlStr);*/
	$('#duzi').hide();
	var htmlStr = '';
	if ((tv>1) && (linenum==1))
	{
		//专题
	var DetailTopStr = '<div id="Detail_Top">'+
        '    <div id="Detail_Intro_Left_zt">'+
        '        <img src="' + imgurl + '"/>'+
        '    </div> '+
        '    <div id="Detail_Intro_Right_zt">'+
        '       <ul>'+
        '        <h1>' + title + '</h1>'+
        '        <a href="' + file + '" target="_self"><button></button></a>'+
        '       </ul>'+
        '    </div>'+
    '</div>';
	}
	else
	{
	var DetailTopStr = '<div id="Detail_Top">'+
        '    <div id="Detail_Intro_Left">'+
        '        <img src="' + imgurl + '"/>'+
        '    </div> '+
        '    <div id="Detail_Intro_Right">'+
        '       <ul>'+
        '        <h1>' + title + '</h1>'+
        '        <a href="' + file + '" target="_self"><button></button></a>'+
        '        <li><b>导演: </b>' + director + '</li> '+
        '        <li><b>主演:</b> ' + actor + ' </li>'+
        '       </ul>'+
        '    </div>'+
    '</div>';
	}
if ((tv>1) && (linenum==1))
{
//专题
	var DetailIntrojjStr = '<div id="Ditail_Intro_Num_zt">'+
        ' 	<ul>'+
        '    	<h1>专题列表：</h1>'+
        sub_jiStr+
        '    </ul>'+
        '</div>';
	var page = $.trim($(obj).find('page').text());
	var page_count = $.trim($(obj).find('page_count').text());
	var firstPage = page - 1;
	if (1>firstPage)
	{
		firstPage = 1;
	}
	var lastPage = page_count;
	var prevPage =  page - 1;
	if (1>prevPage)
	{
		prevPage = 1;
	}
	var nextPage =  parseInt(page) + 1;
	if (page_count<nextPage)
	{
		nextPage = page_count;
	}
	var footStr = '<div id="fenye"><ul><li><a href="javascript:;" onclick="toPlay(' + mId+','+firstPage + ')"><img src="/images/iphone/but_fenye_11.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + prevPage + ')" ><img src="/images/iphone/but_fenye_21.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + nextPage + ')"><img src="/images/iphone/but_fenye_31.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + lastPage + ')"><img src="/images/iphone/but_fenye_41.png" /></a></li></ul></div>';
	DetailIntrojjStr = DetailIntrojjStr + footStr;
}
else if (tv>1)
{
	//电视
	var DetailIntrojjStr = '<div id="Ditail_Intro_Num">'+
        ' 	<ul>'+
        '    	<h1>剧集列表：</h1>'+
        sub_jiStr+
        '    </ul>'+
        '</div>';
	var page = $.trim($(obj).find('page').text());
	var page_count = $.trim($(obj).find('page_count').text());
	var firstPage = page - 1;
	if (1>firstPage)
	{
		firstPage = 1;
	}
	var lastPage = page_count;
	var prevPage =  page - 1;
	if (1>prevPage)
	{
		prevPage = 1;
	}
	var nextPage =  parseInt(page) + 1;
	if (page_count<nextPage)
	{
		nextPage = page_count;
	}
	var footStr = '<div id="fenye"><ul><li><a href="javascript:;" onclick="toPlay(' + mId+','+firstPage + ')"><img src="/images/iphone/but_fenye_11.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + prevPage + ')" ><img src="/images/iphone/but_fenye_21.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + nextPage + ')"><img src="/images/iphone/but_fenye_31.png" /></a></li><li><a href="javascript:;" onclick="toPlay(' + mId+',' + lastPage + ')"><img src="/images/iphone/but_fenye_41.png" /></a></li></ul></div>';
	DetailIntrojjStr = DetailIntrojjStr + footStr;
}
else
{
	var DetailIntrojjStr = '<div id="Ditail_Intro_jj">'+
        ' 	<ul>'+
        '    	<h1>剧情简介：</h1>'+
        '        <li>' + content + '</li>'+
        '    </ul>'+
        '</div>';
}
	$('#Detail').empty();
	$('#Detail').append(DetailTopStr);
	$('#Detail').append(DetailIntrojjStr);
	//alert(DetailTopStr);
    //loadMovie(file);
	
if (tv>1)
{
	/*
    var prevFile = mId - 1;
    var nextFile = mId - 0 + 1;
    var prevPlay = prevFile ? 'toPlay(' + prevFile + ');' : '';
    var nextPlay = nextFile ? 'toPlay(' + nextFile + ');' : '';
	*/
    //var footStr = '<div class="infoCtrl"><a href="javascript:;" onclick="toggleShow(\'infoBox\',this);" class="hide">显示/隐藏</a></div><div class="primary"><div class="playCtrl"><a href="javascript:;" onclick="' + prevPlay + '" class="prev">上一个</a> <a href="javascript:;" onclick="playMovie();" class="play">播放</a> <a href="javascript:;" onclick="' + nextPlay + '" class="next">下一个</a> </div></div>';
	
}

	/*
    $('#footer').empty();
    var prevFile = mId - 1;
    var nextFile = mId - 0 + 1;
    var prevPlay = prevFile ? 'toPlay(' + prevFile + ');' : '';
    var nextPlay = nextFile ? 'toPlay(' + nextFile + ');' : '';
    var footStr = '<div class="infoCtrl"><a href="javascript:;" onclick="toggleShow(\'infoBox\',this);" class="hide">显示/隐藏</a></div><div class="primary"><div class="playCtrl"><a href="javascript:;" onclick="' + prevPlay + '" class="prev">上一个</a> <a href="javascript:;" onclick="playMovie();" class="play">播放</a> <a href="javascript:;" onclick="' + nextPlay + '" class="next">下一个</a> </div></div>';
	var footStr = '<ul><li><a href="javascript:;" onclick="' + prevPlay + '" ><img src="/images/iphone/but_fenye_21.png" /></a></li><li><a href="javascript:;" onclick="' + nextPlay + '"><img src="/images/iphone/but_fenye_31.png" /></a></li></ul>';

    $('#footer').append(footStr);
    loadXML('/iface/ipadlist/' + $('#header').find('.active a')[0].id.substring(2) + '/best.xml', initBest, '0');
	*/
}
function initLivePlayer(obj, mId, day, fresh){
	$('#Detail').show();
    var monthArray = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
    var weekArray = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
    var today = new Date();
    var hour = today.getHours();
    var min = today.getMinutes();
    var yesterday = new Date(today - 24 * 60 * 60 * 1000);
    var beforeday = new Date(today - 48 * 60 * 60 * 1000);
    if (today.getDay() == 0 || today.getDay() == 6) {
    	todaySunday = ' weekend'
    } else {
    	todaySunday = '';
    }
    if (yesterday.getDay() == 0 || yesterday.getDay() == 6) {
    	yesterdaySunday = ' weekend'
    } else {
    	yesterdaySunday = '';
    }
    if (beforeday.getDay() == 0 || beforeday.getDay() == 6) {
    	beforedaySunday = ' weekend'
    } else {
    	beforedaySunday = '';
    }
    var todayNow = (day == 1)?' class="select"':'';
    var yesterdayNow = (day == 2)?' class="select"':'';
    var beforedayNow = (day == 3)?' class="select"':'';
    //var todayStr = '<div class="day' + todaySunday + todayNow + '" onclick="toLive(' + mId + ',1,\'nore\')">' + today.getFullYear() + '年<br />' + monthArray[today.getMonth()] + '月<strong>' + today.getDate() + '</strong>' + weekArray[today.getDay()] + '</div>';
	var todayStr = '<li><a href="javascript:;" onclick="toLive(' + mId + ',1,\'nore\')" '+todayNow+'><span class="top">' + (today.getMonth()+1) + '月' + today.getDate() + '日</span><span>' + weekArray[today.getDay()] + '</span></a></li>';
	//alert(todayStr);return false;
    //var yesterdayStr = '<div class="day' + yesterdaySunday + yesterdayNow + '" onclick="toLive(' + mId + ',2,\'nore\')">' + yesterday.getFullYear() + '年<br />' + monthArray[yesterday.getMonth()] + '月<strong>' + yesterday.getDate() + '</strong>' + weekArray[yesterday.getDay()] + '</div>';
	var yesterdayStr = '<li><a href="javascript:;" onclick="toLive(' + mId + ',2,\'nore\')" '+yesterdayNow+'><span class="top">' + (yesterday.getMonth()+1) + '月' + yesterday.getDate() + '日</span><span>' + weekArray[yesterday.getDay()] + '</span></a></li>';
    //var beforedayStr = '<div class="day' + beforedaySunday + beforedayNow + '" onclick="toLive(' + mId + ',3,\'nore\')">' + beforeday.getFullYear() + '年<br />' + monthArray[beforeday.getMonth()] + '月<strong>' + beforeday.getDate() + '</strong>' + weekArray[beforeday.getDay()] + '</div>';
	var beforedayStr = '<li><a href="javascript:;" onclick="toLive(' + mId + ',3,\'nore\')" '+beforedayNow+'><span class="top">' + (beforeday.getMonth()+1) + '月' + beforeday.getDate() + '日</span><span>' + weekArray[beforeday.getDay()] + '</span></a></li>';
    var file = $.trim($(obj).find('streamer').text());
    var title = $.trim($($(obj).find('title')[0]).text());
	var titlestr = title;
    var playBoxStr = '<div class="playBox"><h1>' + title + '</h1><video id="splayer" width="100%" height="520" controls="controls" autoplay="autoplay"><source src="' + file + '" type="video/mp4" /></video></div>';
	var filestr = file;
    var scheduleStr = '';
    var scrollrow = 0;
	$('#duzi').hide();
    $(obj).find('video_list video').each(function(i){
        var start = $(this).attr('start');
        var end = $(this).attr('end');
        var file = $.trim($(this).find('m3u8').text());
        var start_d = start.substring(0,start.indexOf(' '))
        start_d = start_d.replace(/-/g, '/');
        var start_t = start.substring(start.indexOf(' '))
        var end_d = end.substring(0,end.indexOf(' '))
        end_d = end_d.replace(/-/g, '/');
        var end_t = end.substring(end.indexOf(' '))
        var active = '';
        var date1 = new Date(start_d + start_t);
        var date2 = new Date(end_d + end_t);
        var date = new Date();
		if (0===i)
		{
			active = ' class="top"';
		}
		if ( (date < date1) && (date < date2))
		{
			active = ' class="bottom"';
		}
		/*
		if ((date >= date1) && (date <= date2)) {
            //active = ' class="active"';
            active = ' class="top"';
            scrollrow = i;
        }
		*/
        var startTime = start.substring(start.indexOf(' '), 16);
        var title = $.trim($(this).find('title').text());
		if (active === ' class="bottom"')
		{
			scheduleStr += '<li ' + active + '><b>' + startTime + '</b><b> ' + title + '</b></li>';
		}
		else
		{
			scheduleStr += '<li ' + active + '><a href="'+file+'" target="_self" onclick="highLight(this);"><b>' + startTime + '</b><b> ' + title + '</b></a></li>';
		}
		

		/*
        if (date < date1) {
        	//scheduleStr += '<li' + active + '><a href="javascript:;">' + startTime + ' ' + title + '</a></li>';
        	scheduleStr += '<li ' + active + '><a href="javascript:;" target="_blank"><b>' + startTime + '</b><b> ' + title + '</b></a></li>';
        } else {
        	//scheduleStr += '<li' + active + '><a href="javascript:;" onclick="loadMovie(\'' + file + '\');highLight(this);">' + startTime + ' ' + title + '</a></li>';
        	scheduleStr += '<li' + active + '><a href="javascript:;" target="_blank" onclick="loadMovie(\'' + file + '\');highLight(this);"><b>' + startTime + '</b><b> ' + title + '</b></a></li>';
        }
		*/
    });
	
    //scheduleStr = '<div class="schedule"><ul>' + scheduleStr + '</ul></div><a href="javascript:;" ontouchstart="roll(-1);" ontouchend="clearRoll();" class="rollUp">上滚</a><a href="javascript:;" ontouchstart="roll(1);" ontouchend="clearRoll();" class="rollDown">下滚</a>';
	scheduleStr = '<div id="zb_list"><ul>' + scheduleStr + '</ul></div>';
	//var infoBoxStr = '<div id="infoBox"><div class="infoBox"><div class="calendar">' + beforedayStr + yesterdayStr + todayStr + '</div>' + scheduleStr + '</div></div>';
	
	var infoBoxStr = '<div id="Time">'+
     	'<ul>'+
        beforedayStr+
		yesterdayStr+
		todayStr+
        '</ul>'+
    '</div>' + 
	'<div id="zb_tit">'+titlestr+'<span><a href="'+filestr+'" target="_self"><img src="/images/iphone/but_back.png" /></a></span></div>'+
	scheduleStr ;
	$('#Detail').empty();
	$('#Detail').append(infoBoxStr);	
	//$('#Detail').replaceWith(infoBoxStr);
	//prompt('',infoBoxStr);
	return false;
	/*
    if (fresh) {
         $('#body .primary #infoBox').replaceWith(infoBoxStr);
    } else {
        var htmlStr = '<div class="primary">'+ infoBoxStr + playBoxStr + '</div>';
       if (!window.first) {
            $('#body').empty();
            $('#body').append(htmlStr);
        } else {
            $('#body .primary').replaceWith(htmlStr);
            $('.secondary .cLive .back').unbind('click');
            $('.secondary .cLive .back').bind('click', function() {
                toLive(mId);
            });
        }
        $('#body').find('.schedule')[0].scrollTop = 35 * scrollrow;
        loadMovie(file);

        $('#footer').empty();
        var footStr = '<div class="infoCtrl"><a href="javascript:;" onclick="toggleShow(\'infoBox\',this);" class="hide">显示/隐藏</a></div>';
        $('#footer').append(footStr);
        if (!window.first) {
            loadXML('/iface/ipadlist/' + $('#header').find('.active a')[0].id.substring(2) + '/best.xml', initBest, mId);
            window.first = true;
        }
    }
	*/
}
function rollBase(direct) {
	if (direct>0) {
		$('#body').find('.schedule')[0].scrollTop += 3;
	} else {
		$('#body').find('.schedule')[0].scrollTop -= 3;
	}
}
var myInterval;
function roll(direct) {
	if (myInterval) {
		clearInterval(myInterval);
	}
	myInterval = setInterval(function(){
		rollBase(direct);
	}, 50);
}
function clearRoll() {
	if (myInterval) {
		clearInterval(myInterval);
	}
}